<template xmlns="http://www.w3.org/1999/html">
  <div class="app-container">
    <!-- <template>
      <el-tag style="margin: 0 10px 10px 0">
        <span>充值余额：{{ totalForm.totalRechargeAmt }}</span>
      </el-tag>
      <el-tag style="margin: 0 10px 10px 0">
        <span>账户余额：{{ totalForm.totalAccountAmt }}</span>
      </el-tag>
      <el-tag style="margin: 0 10px 10px 0">
        <span>绿积分：{{ totalForm.totalGreenAmt }}</span>
      </el-tag>
      <el-tag style="margin: 0 10px 10px 0">
        <span>红积分：{{ totalForm.totalRedAmt }}</span>
      </el-tag>
      <el-tag style="margin: 0 10px 10px 0">
        <span>黄积分：{{ totalForm.totalLYellowAmt }}</span>
      </el-tag>
      <el-tag style="margin: 0 10px 10px 0">
        <span>联盟积分：{{ totalForm.totalUniteAmt }}</span>
      </el-tag>
      <el-tag style="margin: 0 0px 10px 0">
        <span>任务积分：{{ totalForm.totalTaskAmt }}</span>
      </el-tag>

    </template> -->

    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="110px">
      <el-form-item label="用户ID" prop="userId">
        <el-input v-model="queryParams.userId" placeholder="请输入用户ID" clearable size="small"
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="用户手机号" prop="account">
        <el-input v-model="queryParams.account" placeholder="请输入用户手机号" clearable size="small"
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="注册时间">
        <el-date-picker v-model="dateRange" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange"
          range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索
        </el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置
        </el-button>
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange" @sort-change="handleSort">
      <el-table-column label="用户ID" align="center" prop="userId" />
      <el-table-column label="用户账号" align="center" prop="account" />

      <el-table-column label="用户等级" align="center" prop="teamLevel" />
      <el-table-column label="加入时间" align="center" prop="registerTime" />
      <el-table-column label="最近访问时间" align="center" prop="lastLoginTime" />
      <el-table-column label="团队人数" align="center" prop="teamCnt" />
      <el-table-column label="USDT" align="center" prop="usdtAmt" sortable />
      <el-table-column label="PUSD" align="center" prop="pusdAmt" sortable />
      <el-table-column label="PNC" align="center" prop="pncAmt" sortable />
      <el-table-column label="GPU" align="center" prop="gpuAmt" sortable />
      <!-- <el-table-column label="联盟积分" align="center" prop="uniteAmt" sortable />
      <el-table-column label="任务积分" align="center" prop="taskAmt" sortable /> -->
      <!-- <el-table-column label="活跃值" align="center" prop="activeAmt" sortable /> -->

      <el-table-column label="是否购买协议" align="center" prop="" />
      <!-- <el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
      <el-table-column label="团队等级" align="center" prop="teamLevel" :formatter="teamLevelFormat" /> -->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <!-- <el-button size="mini" type="text" icon="el-icon-tickets" @click="handleUserBill(scope.row)">资产记录
          </el-button> -->
          <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)">详情
          </el-button>
          <!-- <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleCloseAccount(scope.row)"
            v-hasPermi="['admin:user:closeAccount']"
            >注销账户
          </el-button>
          
           -->
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleEdit(scope.row)">余额修改</el-button>
          <!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="handleEdit(scope.row)">余额修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-close" v-if="scope.row.status === 0"
            @click="handleForbidden(scope.row)">冻结账户</el-button>
          <el-button size="mini" type="text" icon="el-icon-check" v-if="scope.row.status === 1"
            @click="handleUnForbidden(scope.row)">解冻账户</el-button> -->
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />
    <!-- 用户明细 -->
    <el-dialog :title="title" :visible.sync="detailDialogTableVisible" width="1100px" append-to-body>

      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="用户信息" name="1">

          <el-form ref="form" :inline="true" :model="form" label-width="120px">
            <el-col :span="24">
              <el-form-item label="基本信息:"></el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item :span="3" label="用户ID:">{{
            form.userId
          }}</el-form-item>
              <el-form-item :span="3" label="用户账号:">{{
            form.account
          }}</el-form-item>
              <el-form-item :span="3" label="注册时间">{{
            form.registerTime
          }}</el-form-item>
              <el-form-item :span="3" label="实名认证" v-if="form.identifyFlag == 0">未实名</el-form-item>
              <el-form-item :span="3" label="实名认证" v-if="form.identifyFlag == 1">已实名</el-form-item>
            </el-col>

            <el-col :span="24">
              <el-form-item :span="3" label="会员等级:" v-if="form.vipLevel == 0">普通用户</el-form-item>
              <el-form-item :span="3" label="会员等级:" v-if="form.vipLevel == 1">VIP</el-form-item>

            </el-col>
            <el-col :span="24">
              <el-form-item label="用户资产:"></el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item :span="6" label=" USDT" style="color: red">{{
            form.usdtAmt
          }}</el-form-item>
              <el-form-item :span="6" label="PUSD" style="color: red">{{
            form.pusdAmt
          }}</el-form-item>
              <el-form-item :span="6" label="PNC" style="color: red">{{
            form.pncAmt
          }}</el-form-item>
              <el-form-item :span="6" label="GPU" style="color: red">{{
            form.gpuAmt
          }}</el-form-item>

            </el-col>
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="协议订单" name="2">
          <el-table v-loading="loadingone" :data="userListone" @selection-change="handleSelectionChange"
            @sort-change="handleSort">
            <el-table-column label="订单号" align="center" prop="orderSn" />
            <!-- <el-table-column label="订单时间" align="center" prop="createTime" /> -->

            <el-table-column label="下单时间" align="center" prop="createTime" />
            <el-table-column label="订单价格" align="center" prop="creativeAmt" />
            <el-table-column label="订单状态" align="center" prop="orderStatus">
              <template slot-scope="scope">
                <span>{{scope.$index.orderStatus==1?'已结束':'进行中'}}</span>
              </template>
            </el-table-column>

            <el-table-column label="订单类型" align="center">
              <template>
                <span>协议订单</span>
              </template>
            </el-table-column>
          </el-table>
          <pagination v-show="totalone > 0" :total="totalone" :page.sync="queryParamsone.pageNum"
            :limit.sync="queryParamsone.pageSize" @pagination="getlistone" />
        </el-tab-pane>
        <el-tab-pane label="超算订单" name="3">
          <el-table v-loading="loadingone" :data="userListone" @selection-change="handleSelectionChange"
            @sort-change="handleSort">
            <el-table-column label="订单号" align="center" prop="orderSn" />
            <el-table-column label="算力名称" align="center" prop="serverName" />

            <el-table-column label="下单时间" align="center" prop="createTime" />
            <el-table-column label="订单价格" align="center" prop="creativeAmt" />
            <el-table-column label="订单状态" align="center" prop="orderStatus">
              <template slot-scope="scope">
                <span>{{scope.$index.orderStatus==1?'已结束':'进行中'}}</span>
              </template>
            </el-table-column>

            <el-table-column label="订单类型" align="center">
              <template>
                <span>算力订单</span>
              </template>
            </el-table-column>
          </el-table>
          <pagination v-show="totalone > 0" :total="totalone" :page.sync="queryParamsone.pageNum"
            :limit.sync="queryParamsone.pageSize" @pagination="getlisttwo" />
        </el-tab-pane>
        <el-tab-pane label="流水记录" name="4">
          <el-table v-loading="loadingone" :data="userListone" @selection-change="handleSelectionChange"
            @sort-change="handleSort">
            <el-table-column label="流水项目" align="center" prop="title">

            </el-table-column>
            <el-table-column label="流水类型" align="center" prop="amtType">
              <template slot-scope="scope">
                <!-- 1、USDT 2、PUSD 3、PNC 4、GPU -->
                <span>{{scope.row.amtType==1?'USDT':scope.row.amtType==2?'PUSD':scope.row.amtType==3?'PNC':scope.row.amtType==4?'GPU':""}}</span>
              </template>
            </el-table-column>
            <!-- <el-table-column label="订单时间" align="center" prop="createTime" /> -->

            <el-table-column label="时间" align="center" prop="createTime" />
            <el-table-column label="金额" align="center" prop="tradeAmt" />

            <el-table-column label="类型" align="center" prop="tradeType">
              <template slot-scope="scope">
                <span>{{scope.$index.tradeType==1?'收入':'支出'}}</span>
              </template>
            </el-table-column>

          </el-table>
          <pagination v-show="totalone > 0" :total="totalone" :page.sync="queryParamsone.pageNum"
            :limit.sync="queryParamsone.pageSize" @pagination="getlistthree" />
        </el-tab-pane>
        <el-tab-pane label="团队记录" name="5">
          <el-table v-loading="loadingone" :data="userListone" @selection-change="handleSelectionChange"
            @sort-change="handleSort">
            <el-table-column label="用户Id" align="center" prop="userId" />
            <!-- <el-table-column label="订单时间" align="center" prop="createTime" /> -->

            <el-table-column label="个人业绩" align="center" prop="userOrderAmt" />
            <el-table-column label="团队业绩" align="center" prop="teamOrderAmt" />
            <el-table-column label="加入时间" align="center" prop="registerTime" />
            <el-table-column label="团队等级" align="center" prop="teamLevel" />

          </el-table>
          <pagination v-show="totalone > 0" :total="totalone" :page.sync="queryParamsone.pageNum"
            :limit.sync="queryParamsone.pageSize" @pagination="getlistform" />
        </el-tab-pane>
        <el-tab-pane label="提现记录" name="6">
          <el-table v-loading="loadingone" :data="userListone" @selection-change="handleSelectionChange"
            @sort-change="handleSort">
            <el-table-column label="提现时间" align="center" prop="createTime" />
            <!-- <el-table-column label="订单时间" align="center" prop="createTime" /> -->
            <el-table-column label="提现类型" align="center" prop="amtType">
              <template slot-scope="scope">
                <!-- 1、USDT 2、PUSD 3、PNC 4、GPU -->
                <span>{{scope.row.amtType==1?'USDT':scope.row.amtType==2?'PUSD':scope.row.amtType==3?'PNC':scope.row.amtType==4?'GPU':""}}</span>
              </template>
            </el-table-column>
            <!-- <el-table-column label="提现方式" align="center" prop="" /> -->
            <el-table-column label="提现地址" align="center" prop="account" />

            <el-table-column label="提现金额" align="center" prop="withdrawAmt" />
            <el-table-column label="手续费" align="center" prop="serviceFee" />
            <el-table-column label="提现地址" align="center" prop="creativeAmt" />
            <el-table-column label="实际到账" align="center" prop="actualAmt" />

            <el-table-column label="订单状态" align="center" prop="orderStatus">
              <template slot-scope="scope">
                <span>{{scope.$index.orderStatus==1?'已到账':scope.$index.orderStatus==-1?'已拒绝':'审核中'}}</span>
              </template>
            </el-table-column>

          </el-table>
          <pagination v-show="totalone > 0" :total="totalone" :page.sync="queryParamsone.pageNum"
            :limit.sync="queryParamsone.pageSize" @pagination="getlistfive" />
        </el-tab-pane>

        <!-- <el-tab-pane label="定时任务补偿" name="4">定时任务补偿</el-tab-pane> -->
      </el-tabs>

      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">关闭</el-button>
      </div>
    </el-dialog>
    <!-- 资产记录 -->
    <el-dialog :title="title" :visible.sync="dialogTableVisible4" width="1200px" append-to-body>
      <el-form :model="userBillQueryParams" ref="UserBillQueryForm" :inline="true" v-show="showSearch">
        <el-form-item label="交易日期" prop="queryDate">
          <el-date-picker v-model="userBillQueryParams.queryDate" type="date" value-format="yyyy-MM-dd"
            placeholder="选择日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="金额类型" prop="amtType">
          <el-select v-model="userBillQueryParams.amtType" placeholder="金额类型" clearable size="small">
            <el-option v-for="item in amtTypeOptions" :key="item.dictValue" :label="item.dictLabel"
              :value="item.dictValue" />
          </el-select>
        </el-form-item>
        <el-form-item label="交易类型" prop="tradeType">
          <el-select v-model="userBillQueryParams.tradeType" placeholder="交易类型" clearable size="small">
            <el-option v-for="item in tradeTypeOption" :key="item.dictValue" :label="item.dictLabel"
              :value="item.dictValue" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery1">搜索
          </el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery1">重置
          </el-button>
        </el-form-item>
      </el-form>
      <el-table :data="userBillList">
        <el-table-column label="交易时间" align="center" prop="createTime" width="200px" />
        <el-table-column label="标题" align="center">
          <template slot-scope="scope">
            <span style="font-size: 20px">{{ scope.row.title }}</span><span v-if="scope.row.remark"
              style="font-size: 10px; color: #c03639">(备注:{{ scope.row.remark }})</span>
          </template>
        </el-table-column>
        <el-table-column label="金额" align="center" prop="tradeAmt" />
        <el-table-column label="金额类型" align="center" prop="amtType" :formatter="amtTypeFormat" />
        <el-table-column label="交易类型" align="center" prop="tradeType" :formatter="tradeTypeFormat" />
      </el-table>
      <pagination :total="userBillTotal" :page.sync="userBillQueryParams.pageNum"
        :limit.sync="userBillQueryParams.pageSize" @pagination="getUserBillList" />
    </el-dialog>

    <!-- 用户明细 -->
    <el-dialog width="35%" :title="title" :visible.sync="detailDialogTableVisible1" append-to-body>

      <el-form :model="editUserAmtForm" ref="editUserAmtForm" label-width="120px" class="demo-ruleForm">
        <el-form-item label="充值类型" prop="tradeType">
          <el-radio-group v-model="amttypevalue">
            <el-radio :label="1">USDT</el-radio>
            <el-radio :label="2">PUSD</el-radio>
            <el-radio :label="3">PNC</el-radio>
            <el-radio :label="4">GPU</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item
          :label="amttypevalue == 1 ? 'USDT' : amttypevalue == 2 ? 'PUSD' : amttypevalue == 3 ? 'PNC' : amttypevalue == 4 ? 'GPU' : ''">
          {{ amttypevalue == 1 ? itemnum.rechargeAmt : amttypevalue == 2 ? itemnum.accountAmt : amttypevalue == 3 ?
            itemnum.greenAmt : amttypevalue == 6 ? itemnum.uniteAmt : ''
          }}
        </el-form-item>
        <el-form-item label="交易类型" prop="tradeType">
          <el-select v-model="editUserAmtForm.tradeType" placeholder="请选择">
            <el-option label="充值" value="1"></el-option>
            <el-option label="扣除" value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="交易数量" prop="tradeAmt">
          <el-input-number v-model="editUserAmtForm.tradeAmt" :min="1" placeholder="请输入交易数量" :step="1" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitUserAmtForm()">确定 </el-button>
        <el-button @click="cancel1">取消</el-button>
      </div>
    </el-dialog>

    <!-- 用户冻结 -->
    <el-dialog :title="title" :visible.sync="forbiddenFormDisable" width="500px" append-to-body>
      <el-form ref="forbiddenForm" :model="forbiddenForm">
        <el-form-item label="冻结天数" style="width: 500px">
          <el-radio-group v-model="forbiddenDayType">
            <el-radio-button label="1">冻结1天</el-radio-button>
            <el-radio-button label="2">冻结3天</el-radio-button>
            <el-radio-button label="3">冻结7天</el-radio-button>
            <el-radio-button label="0">永久冻结</el-radio-button>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForbiddenForm">确 定</el-button>
        <el-button @click="cancelForbiddenForm">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  getUserPage,
  getUserInfo,
  getUserBillPage,
  changeUserStatus,
  getUserTotal,
  closeAccount,
  updateUserAmt,
  forbiddenUser,
  unForbiddenUser,
  creativeorderlist,
  powerServerorderlist,
  userBilllist,
  listUserTeam,
  userWithdrawlists,
} from "@/api/admin/user";

export default {
  name: "TaskManage",
  data() {
    return {
      // 遮罩层

      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数

      // 任务详情表格数据
      userList: [],
      // 弹出层标题
      title: "",
      //查询日期
      dateRange: [],
      // 是否显示弹出层
      open: false,
      // 查询参数
      loading: true,
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 10,

      },
      loadingone: true,
      totalone: 0,
      queryParamsone: {
        pageNum: 1,
        pageSize: 10,
        userId: ""
      },
      userListone: [],
      formone: {},
      // 表单参数
      form: {},
      detailDialogTableVisible: false,
      requestUrl: this.$img.requestUrl,
      // 充值增减
      tradeTypeOption: [],
      dialogTableVisible4: false,
      userBillQueryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      amtTypeOptions: [],
      userBillList: [],
      userBillTotal: 0,
      totalForm: {
        totalConsumeAmt: 0,
        totalContributeAmt: 0,
        totalFundContributeAmt: 0,
        totalLockContributeAmt: 0,
        totalUserAmt: 0,
        totalJkfAmt: 0,
        totalActiveAmt: 0
      },
      detailDialogTableVisible1: false,
      editUserAmtForm: {},
      forbiddenForm: {},
      forbiddenFormDisable: false,
      //账户冻结
      forbiddenDayType: "1",
      statusOptions: [
        { dictValue: 0, dictLabel: "正常" },
        { dictValue: 1, dictLabel: "冻结" },
      ],
      teamLevelOptions: [
        { dictValue: 0, dictLabel: "普通用户" },
        { dictValue: 1, dictLabel: "一星" },
        { dictValue: 2, dictLabel: "二星" },
        { dictValue: 3, dictLabel: "三星" },
        { dictValue: 4, dictLabel: "四星" },
        { dictValue: 5, dictLabel: "五星" },
        { dictValue: 6, dictLabel: "六星" },
      ],
      amttypevalue: 1,
      itemnum: {},
      activeName: "1"
    };
  },
  created() {
    this.getList();
    // this.getTotal();
    //  :label="item.dictLabel"
    //           :value="item.dictValue"
    this.amtTypeOptions = [{
      dictLabel: "USDT",
      dictValue: 1,
    },
    {
      dictLabel: "PUSD ",
      dictValue: 2,
    },
    {
      dictLabel: "PNC",
      dictValue: 3,
    },
    {
      dictLabel: "GPU",
      dictValue: 4,
    }

    ]
    this.getDicts("trade_type").then((response) => {
      // this.tradeTypeOption = response.data;
    });
    //字典类型
    this.getDicts("amt_type").then((response) => {
      this.amtTypeOptions = response.data;
    });
  },
  methods: {
    handleClick(tab, event) {

      this.queryParamsone.pageNum = 1
      this.userListone = []
      if (this.activeName == 2) {
        console.log(111)
        this.getlistone()
      } else if (this.activeName == 3) {
        this.getlisttwo()
      }
      else if (this.activeName == 4) {
        this.getlistthree()
      }
      else if (this.activeName == 5) {
        this.getlistform()
      }
      else if (this.activeName == 6) {
        this.getlistfive()
      }

    },
    //选择充值条件
    radioGroupChange(e) {
      // console.log(e);
    },
    // getTotal () {
    //   getUserTotal(this.addDateRange(this.queryParams, this.dateRange)).then(
    //     (response) => {
    //       this.totalForm = response.data;
    //     }
    //   );
    // },
    getList() {
      this.loading = true;
      getUserPage(this.addDateRange(this.queryParams, this.dateRange)).then(
        (response) => {
          this.userList = response.rows;
          this.total = response.total;
          this.loading = false;
        }
      );
    },
    getlistone() {
      this.loadingone = true;
      creativeorderlist(this.addDateRange(this.queryParamsone, {})).then(
        (response) => {
          this.userListone = response.rows;
          this.totalone = response.total;
          this.loadingone = false;
        }
      );
    },
    getlisttwo() {
      this.loadingone = true;
      powerServerorderlist(this.addDateRange(this.queryParamsone, {})).then(
        (response) => {
          this.userListone = response.rows;
          this.totalone = response.total;
          this.loadingone = false;
        }
      );
    },
    getlistthree() {
      this.loadingone = true;
      userBilllist(this.addDateRange(this.queryParamsone, {})).then(
        (response) => {
          this.userListone = response.rows;
          this.totalone = response.total;
          this.loadingone = false;
        }
      );
    },
    getlistform() {
      this.loadingone = true;
      listUserTeam(this.addDateRange(this.queryParamsone, {})).then(
        (response) => {
          this.userListone = response.rows;
          this.totalone = response.total;
          this.loadingone = false;
        }
      );
    },
    getlistfive() {
      this.loadingone = true;
      userWithdrawlists(this.addDateRange(this.queryParamsone, {})).then(
        (response) => {
          this.userListone = response.rows;
          this.totalone = response.total;
          this.loadingone = false;
        }
      );
    },

    handleSort(column) {
      if (column.prop == "contributeAmt") {
        this.queryParams.amtType = 1;
      } else if (column.prop == "consumeAmt") {
        this.queryParams.amtType = 2;
      } else if (column.prop == "userAmt") {
        this.queryParams.amtType = 3;
      } else if (column.prop == "lockContributeAmt") {
        this.queryParams.amtType = 4;
      } else if (column.prop == "fundContributeAmt") {
        this.queryParams.amtType = 5;
      } else if (column.prop == "jkfAmt") {
        this.queryParams.amtType = 6;
      } else if (column.prop == "activeAmt") {
        this.queryParams.amtType = 7;
      }
      if (column.order == "ascending") {
        // 升序
        this.queryParams.sortType = 2;
        this.getList();
      } else if (column.order == "descending") {
        // 降序
        this.queryParams.sortType = 1;
        this.getList();
      } else {
        this.resetQuery();
      }
    },
    // 登录状态字典翻译
    amtTypeFormat(row, column) {
      return this.selectDictLabel(this.amtTypeOptions, row.amtType);
    },
    tradeTypeFormat(row, column) {
      return this.selectDictLabel(this.tradeTypeOption, row.tradeType);
    },
    statusFormat(row, column) {
      return this.selectDictLabel(this.statusOptions, row.status);
    },
    teamLevelFormat(row, column) {
      return this.selectDictLabel(this.teamLevelOptions, row.status);
    },
    cancel() {
      this.detailDialogTableVisible = false;
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
      this.getTotal();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.resetForm("queryParams");
      this.queryParams.beginTime = "";
      this.queryParams.endTime = "";
      this.dateRange = [];
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 详细按钮操作 */
    handleView(row) {
      this.form = {};
      this.title = "查看会员信息";
      this.form = row;
      this.queryParamsone.userId = row.userId
      this.detailDialogTableVisible = true;

      // getUserInfo(row.userId).then((res) => {

      // });
    },
    /** 详细按钮操作 */
    handleUserBill(row) {
      this.title = "资产记录";
      this.userBillQueryParams.userId = row.userId;
      this.getUserBillList();
      this.dialogTableVisible4 = true;
    },
    /** 搜索按钮操作 */
    handleQuery1() {
      this.userBillQueryParams.pageNum = 1;
      this.getUserBillList();
    },
    /** 重置按钮操作 */
    resetQuery1() {
      this.resetForm("UserBillQueryForm");
      this.handleQuery1();
    },
    getUserBillList() {
      getUserBillPage(this.userBillQueryParams).then((response) => {
        this.userBillList = response.rows;
        this.userBillTotal = response.total;
      });
    },
    // 用户状态修改
    handleStatusChange(row) {
      let text = row.status === "0" ? "启用" : "停用";
      this.$confirm(
        '确认要"' + text + '""' + row.userName + '"用户吗?',
        "警告",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      )
        .then(function () {
          return changeUserStatus(row.userId, row.status);
        })
        .then(() => {
          this.msgSuccess(text + "成功");
        })
        .catch(function () {
          row.status = row.status === "0" ? "1" : "0";
        });
    },
    // 用户状态修改
    handleCloseAccount(row) {
      this.$confirm("确认要注销该用户吗?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(function () {
          return closeAccount(row.userId);
        })
        .then(() => {
          this.getList();
          this.msgSuccess("注销成功");
        })
        .catch(function () { });
    },
    /** 详细按钮操作 */
    handleEdit(row) {
      this.title = "余额修改";
      this.amttypevalue = 1
      this.detailDialogTableVisible1 = true;
      this.itemnum = row
      this.editUserAmtForm = {
        userId: row.userId,
        tradeAmt: 1,
        tradeType: "2",
        amtType: "3",
      };
    },
    submitUserAmtForm() {
      const _self = this;
      _self.editUserAmtForm.amtType = this.amttypevalue
      // console.log(_self.editUserAmtForm)
      // return

      var titlename = ""
      if (this.amttypevalue == 1) {
        titlename = "USDT "
      } else if (this.amttypevalue == 2) {
        titlename = "PUSD"
      }
      else if (this.amttypevalue == 3) {
        titlename = "PNC"
      } else if (this.amttypevalue == 4) {
        titlename = "GPU"
      }

      this.$refs["editUserAmtForm"].validate((valid) => {
        if (valid) {
          _self
            .$confirm(`确认为该账号${_self.editUserAmtForm.tradeType == 1 ? "充值" : "扣除"}'${titlename}'吗?`, "警告", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
            })
            .then(function () {
              updateUserAmt(JSON.stringify([_self.editUserAmtForm])).then((res) => {
                if (res.code === 200) {
                  _self.msgSuccess(res.msg);
                  _self.getList();
                  _self.cancel1();
                }
              });
            })
            .catch(function () { });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    // 取消按钮
    cancel1() {
      this.detailDialogTableVisible1 = false;
      this.reset1();
    },
    // 表单重置
    reset1() {
      this.editUserAmtForm = {};
      this.resetForm("editUserAmtForm");
    },
    // 冻结
    handleForbidden(row) {
      this.title = "冻结账户";
      this.forbiddenFormDisable = true;
      this.forbiddenForm.userId = row.userId;
    },
    submitForbiddenForm() {
      this.$refs["forbiddenForm"].validate((valid) => {
        if (valid) {
          this.forbiddenForm.forbiddenDayType = parseInt(this.forbiddenDayType);
          forbiddenUser(this.forbiddenForm).then((response) => {
            if (response.code === 200) {
              this.msgSuccess("冻结账户成功");
              this.cancelForbiddenForm();
              this.getList();
            }
          });
        }
      });
    },
    cancelForbiddenForm() {
      this.forbiddenForm = {};
      this.resetForm("forbiddenForm");
      this.forbiddenFormDisable = false;
    },
    /** 用户解冻 */
    handleUnForbidden(row) {
      const userId = row.userId;
      this.$confirm("是否确认解冻该账号?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(function () {
          return unForbiddenUser(userId);
        })
        .then(() => {
          this.getList();
          this.msgSuccess("解冻成功");
        })
        .catch(function () { });
    },
  },
};
</script>
<style scoped lang="scss">
.visible {
  .top {
    background: #d7d7d7;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    font-weight: 900;
    font-size: 18px;
    color: #000000;
  }

  > p {
    display: flex;
    padding: 20px;

    > span {
      margin-right: 20px;

      > span {
        color: #7f7f7f;
      }
    }
  }
}

.status_color {
  color: #7db603;
}

.status_colorRed {
  color: #d9001b;
}

.el-tag {
  padding: 58px;
  font-size: 20px;
}
</style>
